<template>
    <div class="left-box">
        <div class="logo">
            <img src="static/images/logo.png"/>
        </div>
        <el-menu class="sidebar" :unique-opened="true" :default-active="currentPagePath" @open="handleOpen"
                 :router="true" theme="dark" @close="handleClose">
            <el-menu-item index="/dashboard">
                <i class="fa fa-tachometer fa-fw"></i>
                <span>后台主页</span>
            </el-menu-item>
            <el-menu-item index="/dashboard/immune">
                <i class="fa fa-pencil fa-fw"></i>
                <span>免疫管理</span>
            </el-menu-item>
          <el-menu-item index="/dashboard/record">
            <i class="fa fa-medkit fa-fw"></i>
            <span>病历管理</span>
          </el-menu-item>
            <el-menu-item index="/dashboard/user">
                <i class="fa fa-users fa-fw"></i>
                <span>会员管理</span>
            </el-menu-item>
            <el-submenu index="setting">
                <template slot="title">
                    <i class="fa fa-database fa-fw"></i>
                    <span>数据管理</span>
                </template>
                <el-menu-item index="/dashboard/setting/category">
                    <i class="fa fa-circle"></i>
                    <span>分类数据</span>
                </el-menu-item>
                <el-menu-item index="/dashboard/setting/backup">
                    <i class="fa fa-circle"></i>
                    <span>备份与还原</span>
                </el-menu-item>
            </el-submenu>
        </el-menu>
    </div>
</template>

<script>
export default {
  data () {
    return {
      currentPagePath: '/dashboard'
    }
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    hasOwn () {
    }
  },
  mounted () {
    console.log(this.$route.path)
  }
}
</script>
<style>
    .left-box {
        width: 200px;
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 5;
        height: 100%;
        float: left;
        flex-direction: column;
        background: #324157;
    }

    .left-box .sidebar {
        width: 200px;
        flex: 1;
        border-radius: 0;
        background: #324157;
    }

    .left-box .fa {
        margin-right: 10px;
        font-size: 18px;
    }

    .left-box .el-submenu .el-menu-item .fa {
        margin-right: 10px;
        font-size: 10px;
    }

    .left-box .logo {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 120px;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .5);
    }

    .left-box .logo img {
        height: 80px;
    }
</style>
